<template>
  <a-input-number v-model:value="value_" @change="inputHandler" />
</template>
<script lang="ts">
  import { defineComponent, ref } from 'vue';
  import { InputNumber } from 'ant-design-vue';
  import { ConfigItem } from './control.data';
  export default defineComponent({
    components: { [InputNumber.name]: InputNumber },
    props: {
      value: { type: String },
      config: { type: Object as PropType<ConfigItem>, default: () => ({} as ConfigItem) },
    },
    emits: ['update:value'],
    setup(props, { emit }) {
      let value_ = ref(props.value);
      const inputHandler = (e) => {
        const { value } = e.target;
        emit('update:value', value);
      };

      return {
        inputHandler,
        value_,
      };
    },
  });
</script>
